import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);

export default new Router({
  mode: "history",
  routes: [
    {
      path: "/",
      name:"pc-home",
      redirect: "/pc/home",
    },
    {
      path: "/pc",
      name:"pc",
      redirect: "/pc/home",
    },
    {
      path: "/home",
      name:"pc_home",
      redirect: "/pc/home",
    },
    {
        path:'/',
        name:"home",
        component:(resolve) => 
            require(['@/components/common/pc/Home.vue'],resolve),
        meta:{
            title:'自述文件'
        },
        children:[
            {
                path:'/pc/home',
                name:'index',
                component: (resolve) =>
                    require(['@/components/page/pc/index.vue'],resolve),
                meta:{
                    title:'*'
                }
            },
            {
              path:'/pc/newlist',
              name:'newlist',
              component: (resolve) =>
                  require(['@/components/page/pc/newlist.vue'],resolve),
              meta:{
                  title:'*'
              }
          },
          {
            path:'/pc/news',
            name:'news',
            component: (resolve) =>
                require(['@/components/page/pc/news.vue'],resolve),
            meta:{
                title:'*'
            }
        },
            {
                path:'/pc/*',
                name:'*',
                component: (resolve) =>
                    require(['@/components/page/pc/all.vue'],resolve),
                meta:{
                    title:'*'
                }
            },
           
        ]
    },
    {
      path: "/mobile",
      name:"mobile-home",
      redirect: "/mobile/home",
    },
    {
        path:'/mobile',
        name:"m-home",
        component:(resolve) => 
            require(['@/components/common/mobile/m_Home.vue'],resolve),
        meta:{
            title:'自述文件'
        },
        children:[
            {
                path:'/mobile/home',
                name:'m-index',
                component: (resolve) =>
                    require(['@/components/page/mobile/m_index.vue'],resolve),
                meta:{
                    title:'*'
                }
            },
            {
                path:'/mobile/*',
                name:'m-*',
                component: (resolve) =>
                    require(['@/components/page/mobile/m_all.vue'],resolve),
                meta:{
                    title:'*'
                }
            },
        ]
    },
    {
      path: "/admin/home",
      component: (resolve) =>
        require(["@/components/common/Home.vue"], resolve),
      meta: {
        title: "自述文件",
      },
      children: [

        {
          path: "/admin/dashboard",
          component: (resolve) =>
            require(["@/components/page/Dashboard.vue"], resolve),
          meta: {
            title: "首页",
          },
        },
        {
          path: "/admin/liveList",
          name: "liveList",
          component: (resolve) =>
            require(["@/components/page/live/liveList.vue"], resolve),
          meta: {
            title: "直播管理",
          },
        },
        {
          path: "/admin/categoryList",
          name: "categoryList",
          component: (resolve) =>
            require(["@/components/page/live/categoryList.vue"], resolve),
          meta: {
            title: "菜单管理",
          },
        },
        {
          path: "/userInfo",
          name: "userInfo",
          component: (resolve) =>
            require(["@/components/page/user/userInfo.vue"], resolve),
          meta: {
            title: "用户管理",
          },
        },

        {
          path: "/admin/newsList",
          name: "newsList",
          component: (resolve) =>
            require(["@/components/page/live/newsList.vue"], resolve),
          meta: {
            title: "预告管理",
          },
        },

        {
          path: "/admin/news",
          name: "news",
          component: (resolve) =>
            require(["@/components/page/live/news.vue"], resolve),
          meta: {
            title: "编辑预告",
          },
        },

        {
          path: "/404",
          component: (resolve) =>
            require(["@/components/page/404.vue"], resolve),
          meta: {
            title: "404",
          },
        },
      ],
    },
    {
      path: "/admin/login",
      component: (resolve) => require(["@/components/page/Login.vue"], resolve),
    },
    {
      path: "*",
      redirect: "/404",
    },
  ],
});
